const Joi = require("joi");

const id = Joi.number().integer().min(1).required();
const rolename = Joi.string().min(1).max(20).required();
const c_name = Joi.string().min(1).max(20);
const race = Joi.string().pattern(/^[\u4e00-\u9fa5]+$/).min(1).max(10).required();
const age = Joi.number().integer();
const gender = Joi.number().integer().valid(0, 1, 2);
const intro = Joi.string().min(1).max(500);
const types = Joi.number().integer().valid(0, 1, 2, 3);

//新增数据验证
exports.add_Schema = {
	body: {
		rolename,
		c_name,
		race,
		age,
		gender,
		intro,
		types
	}
};

// 更新数据
exports.update_Schema = {
	body: {
		rolename,
		c_name,
		race,
		age,
		gender,
		intro,
		types,
		id
	}
};